<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>MAIL->Attach()</title>
<style>
body, pre {
	font-family: Verdana;
	font-size: 10pt;
}
a {	color: blue; text-decoration: none }
a:hover { text-decoration: underline }
</style>
</head>
<body bgcolor="#f1f3f5" topmargin="10" leftmargin="14">

<pre>
<hr color="white">
MAIL -> <i>boolean</i> <b>attach</b> ( <i>string</i> content [, <i>string</i> type [, <i>string</i> name [, <i>string</i> charset [, <i>string</i> encoding [, <i>string</i> disposition [, <i>string</i> id ]]]]]] )
<hr>
Return TRUE if has been successfully attached, FALSE if not.

Default values are:
<i>string</i> type: application/octet-stream
<i>string</i> charset: us-ascii
<i>string</i> encoding: base64
<i>string</i> disposition: attachment

<i>string</i> encoding possible values are: binary, 7bit, 8bit, quoted-printable or base64
<i>string</i> disposition possible values are: attachment or inline

Example (verification):
<table border="0" bgcolor="white">
<tr><td>
<pre><code>
$m = new MAIL;

// attach source
$a = $m->Attach('text message', 'text/plain');

$f = '/path/image.gif';
// attach file '$f', disposition 'inline' and give a name 'photo.gif' with ID value (this ID value can be used in embed HTML images)
$a = $m->Attach(file_get_contents($f), FUNC::mime_type($f), 'photo.gif', null, null, 'inline', MIME::unique());

echo $a ? 'attached' : 'error';
</code></pre>
</td></tr>
</table>

Example (deprecated):
<table border="0" bgcolor="white">
<tr><td>
<pre><code>
$m = new MAIL;

$f = '/path/image.gif';

$m->Attach[] = array(
'content' => file_get_contents($f), // required
'type' => FUNC::mime_type($f), // optional
'name' => 'image.gif', // optional
'charset' => 'utf-8', // optional
'encoding' => 'base64', // optional
'disposition' => 'inline', // optional
'id' => MIME::unique() // optional
);
</code></pre>
</td></tr>
</table>

<hr color="white">

See Also: <a href="delattach.html">MAIL->DelAttach()</a>, <a href="../func/mime_type.html">FUNC::mime_type()</a>

[ <a href="mail&#116;&#111;:contact&#064;xpertmailer.com?subject=Comment MAIL AddTo">Comments</a> ]

Last update: Monday, June 11, 2007

<hr>
</pre>

</body>
</html>